package com.health.personal.api.factory;

import com.health.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.health.common.core.domain.R;
import com.health.personal.api.RemoteTUserService;

/**
 * 患者登录
 *
 * @author health
 */
@Component
public class RemoteTUserFallbackFactory implements FallbackFactory<RemoteTUserService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteTUserFallbackFactory.class);

    @Override
    public RemoteTUserService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteTUserService()
        {
            @Override
            public R<LoginUser> selectByEmail(String email) {
                return R.fail("获取用户失败:" + throwable.getMessage());
            }
        };
    }
}
